package com.qo.qsdk.ui.base;

import android.app.Activity;
import android.view.View;

import com.qo.qsdk.model.UserModel;
import com.qo.qsdk.ui.QSDKListener;
import com.qo.qsdk.utils.DynamicUtils;
import com.qo.qsdk.utils.Language;
import com.qo.qsdk.utils.QSDKHelper;

public class TipView {

    private QTextView mTitle, mMsg;
    private Activity mActivity;
    private QSDKListener mQSDKListener;

    public TipView(Activity mActivity, QSDKListener qsdkListener) {
        this.mActivity = mActivity;
        this.mQSDKListener = qsdkListener;
        this.mActivity.setContentView(DynamicUtils.layout(this.mActivity, "qsdk_tip"));
        init(mActivity);
    }

    private void init(Activity v) {
        mMsg = v.findViewById(DynamicUtils.id(mActivity, "msg"));
        mTitle = v.findViewById(DynamicUtils.id(mActivity, "title"));
        v.findViewById(DynamicUtils.id(mActivity, "pwdClose")).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mQSDKListener != null) mQSDKListener.onTipClose();
            }
        });
    }

    public void show(Activity activity, String msg) {
        refresh();
        mMsg.setText(msg);
    }

    private void refresh() {
        mTitle.setText(Language.Tip_Title.toString());
    }
}
